import { getToken } from '@/utils/user'
Vue.use(VueRouter)

// 获取原型对象上的push函数
const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const routes = [
  {
    path: '/readFile',
    name: 'readFile',
    component: () => import('@/pages/readFile/index.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

/* 路由守卫 */
router.beforeEach((to, from, next) => {
  next()
})

export default router
